package com.twu.biblioteca.ui.menus;

import com.twu.biblioteca.library.Library;

/**
 * @author Alvi Jonathan Sait
 */
public class InvalidOptionMenu extends AbstractMenu {

    private final AbstractMenu previousMenu;

    public InvalidOptionMenu(Library library, AbstractMenu previousMenu) {
        super(library);
        this.previousMenu = previousMenu;
    }

    /**
     * Returns to the previous menu, usually the calling menu, so that user may be able to input again a new value.
     */
    @Override
    public AbstractMenu handleInput(String input) {
        return previousMenu;
    }

    @Override
    public String getOutput() {
        return "Select a valid option!";
    }

    @Override
    public String getUserPrompt() {
        return "Press <Enter> to return to previous menu.";
    }
}
